package seed_system

import (
	"fmt"
	"gitee.com/theegg/go-brick/app/service/app"
	"gitee.com/theegg/go-brick/database/seed/seed_partner/seed_system/seed_district_data"
)

func InitSystemDistrictSeed() {

	count := 0
	errCount := 0
	for _, item := range seed_district_data.DistrictCnSeedData {
		_, err := app.Db().Insert(item)
		if err != nil {
			fmt.Println(err.Error())
			errCount++
		} else {
			count++
		}
	}

	for _, item := range seed_district_data.DistrictThaSeedData {
		_, err := app.Db().Insert(item)
		if err != nil {
			fmt.Println(err.Error())
			errCount++
		} else {
			count++
		}
	}

	for _, item := range seed_district_data.DistrictSgSeedData {
		_, err := app.Db().Insert(item)
		if err != nil {
			fmt.Println(err.Error())
			errCount++
		} else {
			count++
		}
	}

	for _, item := range seed_district_data.DistrictPhSeedData {
		_, err := app.Db().Insert(item)
		if err != nil {
			fmt.Println(err.Error())
			errCount++
		} else {
			count++
		}
	}

	fmt.Printf("%5s|%25s|%10d|%8d|\n", "", "districts", count, errCount)
}
